Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flicker refactor #161

Merged
merged 42 commits into from
Oct 6, 2022
Merged

Flicker refactor #161

merged 42 commits into from
Oct 6, 2022

Conversation

ppinchuk
Copy link
Collaborator

@ppinchuk ppinchuk commented Sep 30, 2022

Major refactor of flicker to merge a good portion of the setbacks functionality into the flicker routines. In particular, the major goals for this refactor were as follows:

  • Increase flexibility of FLICKER_ARRAY_LEN, such that it no longer errors out for low flicker thresholds or large turbines.
  • Update flicker routine to output a TIFF file just like all of the setbacks routines do.
  • Allow the input of local flicker regulations and support the combination of local and generic regulations just like setbacks do.
  • Allow the input to flicker to be a TIFF file instead of just an H5 layer.
  • Ensure that local regulations (for both flicker and setbacks) are clipped to the respective counties.

This list is not comprehensive, but it does provide the most important updates. All of these issues were identified during the last set of bespoke runs, and were needed to be fixed before any new runs were to be done.

The core technical component of this refactor was to move the logic for running and merging exclusions out of the base setbacks class and into a general-utility framework. The new framework class is now defined in reVX.utilties.exclusions.AbstractBaseExclusionsMerger, with an explicit interface defined in reVX.utilties.exclusions.AbstractExclusionCalculatorInterface. Both the setbacks and the flicker routines implement this interface, allowing both routines to share the logic of calculating local and generic exclusions and merging those together. An added bonus is that the CLI and therefore the configs share the inputs required to perform local and generic merging, so analysist that are familiar with setbacks configs designed with that functionality should be able to apply the same inputs to the flicker configs.

One thing I debated for a long time was a re-organization of the folder structure. In particular, it made a lot of sense to me to create a new "exclusions" module that would hold both the flicker and the setbacks folders. Ultimately I did not end up implementing this change since I felt it may be a bit too disruptive, but I am still very much on the fence about this decision and would happily implement it if it makes sense to others.

All new features should have tests, but I will be keeping a close eye on the coverage report to see if I missed anything major.

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2022

Codecov Report

Merging #161 (e7fff82) into main (3d87add) will increase coverage by 0.69%.
The diff coverage is 95.28%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #161      +/-   ##
==========================================
+ Coverage   81.90%   82.60%   +0.69%     
==========================================
  Files         114      117       +3     
  Lines       12289    12852     +563     
==========================================
+ Hits        10065    10616     +551     
- Misses       2224     2236      +12     
Flag Coverage Δ
unittests 82.60% <95.28%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reVX/setbacks/road_setbacks.py 39.39% <50.00%> (ø)
reVX/setbacks/setbacks_cli.py 60.16% <75.00%> (+0.16%) ⬆️
reVX/turbine_flicker/turbine_flicker_cli.py 70.64% <84.00%> (+1.82%) ⬆️
reVX/utilities/exclusions.py 80.31% <85.88%> (ø)
reVX/turbine_flicker/turbine_flicker.py 94.84% <93.71%> (+6.02%) ⬆️
tests/test_regulations.py 96.38% <96.38%> (ø)
reVX/setbacks/base.py 91.79% <97.56%> (+1.91%) ⬆️
tests/test_setbacks.py 99.33% <98.59%> (+0.19%) ⬆️
reVX/utilities/regulations.py 98.68% <98.68%> (ø)
reVX/cli.py 85.56% <100.00%> (ø)
... and 23 more

@ppinchuk ppinchuk merged commit b633bbc into main Oct 6, 2022
@ppinchuk ppinchuk deleted the pp/flicker_refactor branch October 6, 2022 16:17
github-actions bot pushed a commit that referenced this pull request Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants